<template>
  <!-- 添加或修改排会信息对话框 -->
  <el-dialog :title="$t('申请信息')" :visible.sync="formOpen" :close-on-click-modal="false" :lock-scroll="false" custom-class="dialogForm" append-to-body>
    <mt-meeting-form v-if="type === 'meeting'" ref="applyForm" />
    <mt-arrange-info-form v-if="type === 'mtArrange'" ref="applyForm" />
  </el-dialog>
</template>

<script>
import MtMeetingForm from '@/views/deal/mt/mtMeetingForm.vue'
import MtArrangeInfoForm from '@/views/deal/mt/info/mtArrangeInfoForm.vue'

export default {
  components: { MtArrangeInfoForm, MtMeetingForm },
  data() {
    return {
      meetingId: undefined,
      formOpen: true,
      type: undefined
    }
  },
  mounted() {
    this.meetingId = this.$route.query.id
    this.type = this.$route.query.viewType
    this.$nextTick(() => {
      if (this.type === 'meeting') {
        this.$refs.applyForm.init({ id: this.meetingId, type: 'view' })
      } else if (this.type === 'mtArrange') {
        this.$refs.applyForm.init({ meetingId: this.meetingId, type: 'view' })
      }
    })
  },
  methods: {
    // beforeClose(done) {
    //   var userAgent = navigator.userAgent
    //   if (userAgent.indexOf('Firefox') !== -1 || userAgent.indexOf('Chrome') !== -1) {
    //     window.location.href = 'about:blank'
    //   } else {
    //     window.opener = null
    //     window.open('', '_self')
    //     window.close()
    //   }
    //   done()
    // }
  }
}
</script>

<style scoped>

</style>
